/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package docmanager.operation.sectores;

import bf.*;
import bf.operation.*;
import java.util.*;

import docmanager.business.objects.Sector;
import docmanager.db.*;

import java.sql.Connection;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;


/**
 *
 * @author Jose Luis
 */
public class OpListarSectores extends Operation
{

    @Override
    public Map execute(HttpServletRequest request) throws OperationException
    {
        try
        {
            Connection conn = ConnectionPool.getConnection();
            List l = Sector.obtenerTodosLosSectores(conn);
            Map m = new HashMap();
            m.put("sectores", l);
            ConnectionPool.closeConn(conn);
            return m;
        } catch (SQLException sQLException)
        {
            sQLException.printStackTrace();
            throw new OperationException();
        }
    }

    @Override
    public String getReturnURL()
    {
        return "Sectores/ListarSectores.jsp";
    }
    
}
